package com.psak.cudaphrasal.server.service.task;

import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.ObjectMessage;
import javax.jms.Session;

import org.springframework.jms.core.MessageCreator;

import com.psak.cudaphrasal.model.FileChunkToProcess;

/**
 * Builder budujacy message'a zadania.
 * 
 * @author piotrs10
 * 
 */
public class TaskMessageBuilder implements MessageCreator {
	private FileChunkToProcess chunk;

	public TaskMessageBuilder(FileChunkToProcess chunk) {
		this.chunk = chunk;
	}

	@Override
	public Message createMessage(Session session) throws JMSException {
		ObjectMessage objectMessage = session.createObjectMessage(chunk);
		return objectMessage;
	}

}
